package com.wxzz.elearing.comment.api.admin;


import com.alibaba.fastjson.JSONObject;
import com.wxzz.elearing.comment.dto.CommunityQuestionsAnswersDto;
import com.wxzz.elearing.comment.entity.CommunityQuestionsAnswersList;
import com.wxzz.elearing.comment.entity.QuestionsAnswersList;
import com.wxzz.elearing.comment.service.ICommunityCommentService;
import com.wxzz.elearing.comment.service.ICommunityQuestionsAnswersListService;
import com.wxzz.elearing.comment.vo.CommunityQuestionsAnswersListVo;
import com.wxzz.elearning.common.vo.JgPageVo;
import com.wxzz.elearning.common.vo.ReturnVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author
 * @since 2021-05-14
 */
@RestController
@RequestMapping("/admin-community-list")
@Api(tags = "企业社区类接口(企业)")
public class AdminCommunityController {


    @Autowired
    private ICommunityQuestionsAnswersListService questionsAnswersListService;

    @Autowired
    private ICommunityCommentService iCommunityCommentService;


    @ApiOperation(value = "企业社区问答列表(企业)", notes = "企业社区问答列表(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "queryQuestionsAnswersList", method = RequestMethod.POST)
    public ReturnVO<JgPageVo<List<CommunityQuestionsAnswersListVo>>> queryQuestionsAnswersList(@RequestBody CommunityQuestionsAnswersDto questionsAnswersDto) {
        return questionsAnswersListService.adminQueryQuestionsAnswersList(questionsAnswersDto);
    }

    @ApiOperation(value = "企业社区评论删除(企业)", notes = "企业社区评论删除(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "deleteComment", method = RequestMethod.POST)
    public ReturnVO deleteComment(@RequestBody CommunityQuestionsAnswersDto questionsAnswersDto) {
        return iCommunityCommentService.deleteComment(questionsAnswersDto);
    }

    @ApiOperation(value = "企业社区文章删除(企业)", notes = "企业社区文章删除(企业)", httpMethod = "POST", tags = "企业")
    @RequestMapping(value = "deleteCommunityContent", method = RequestMethod.POST)
    public ReturnVO deleteCommunityContent(@RequestBody CommunityQuestionsAnswersList communityQuestionsAnswersList) {
        return iCommunityCommentService.deleteCommunityContent(communityQuestionsAnswersList);
    }
}
